/*
 * @Description: 奖励记录
 * @Author: iamsmiling
 * @Date: 2021-06-08 22:28:22
 * @LastEditTime: 2021-06-13 12:36:05
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/remote/reward_recod/reward_record_entity.dart';
import 'package:credit_business_circle/pages/mine/children/clock/children/reward_record/reward_record_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class RewardRecordPage extends GetView<RewardRecordController> {
  const RewardRecordPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("奖励记录"),
        elevation: .5,
      ),
      body: Container(
        child: Column(
          children: [
            Container(
              color: R.color.ffffffff,
              height: R.dimen.dp48,
              padding: EdgeInsets.symmetric(horizontal: R.dimen.dp12),
              child: DefaultTextStyle(
                style: TextStyle(
                    fontSize: R.dimen.sp15,
                    color: R.color.ff222222,
                    fontWeight: FontWeight.w600),
                child: Row(
                  children: [
                    Expanded(
                        flex: 2,
                        child: Text(
                          "名称",
                          textAlign: TextAlign.start,
                        )),
                    Expanded(
                        flex: 1,
                        child: Text(
                          "数量",
                          textAlign: TextAlign.center,
                        )),
                    Expanded(
                        flex: 3,
                        child: Text(
                          "时间",
                          textAlign: TextAlign.center,
                        ))
                  ],
                ),
              ),
            ),
            Expanded(
                child: ListView.builder(
              padding: EdgeInsets.symmetric(horizontal: R.dimen.dp12),
              itemBuilder: (BuildContext context, int i) {
                RewardRecordEntity r = controller.records[i];
                return Column(
                  children: [
                    Container(
                      padding: EdgeInsets.symmetric(vertical: R.dimen.dp13),
                      child: Row(
                        children: [
                          Expanded(
                              flex: 2,
                              child: Text(
                                r.label,
                                style: TextStyle(fontSize: R.dimen.sp13),
                              )),
                          Expanded(
                              flex: 1,
                              child: Text(
                                "${r.count}",
                                textAlign: TextAlign.center,
                                style: TextStyle(
                                  fontSize: R.dimen.sp13,
                                  color: R.color.ff111111,
                                ),
                              )),
                          Expanded(
                              flex: 3,
                              child: Text(
                                "${r.date}",
                                textAlign: TextAlign.center,
                                style: TextStyle(
                                    fontSize: R.dimen.sp12,
                                    color: R.color.ff555555),
                              ))
                        ],
                      ),
                    ),
                    Divider(
                      height: 1,
                    )
                  ],
                );
              },
              itemCount: controller.records.length,
            ))
          ],
        ),
      ),
    );
  }
}
